package edu.neusoft.springhtmldemo.mapper;

import edu.neusoft.springhtmldemo.domain.SensorManagement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SensorManagementMapper {
    @Select("select * from sensormanagemententity")
    List<SensorManagement> showSensorManagement();

    @Select("select * from sensormanagemententity where sensorNum like '%' #{sensorNum} '%'" +
            "and sensorName like '%' #{sensorName} '%'")
    List<SensorManagement> selectSensorManagement(String sensorNum, String sensorName);

    @Select("update sensormanagemententity set " +
            "thresUP1=#{thresUP1}," +
            "thresUP2=#{thresUP2}," +
            "thresLow1=#{thresLow1}," +
            "thresLow2=#{thresLow2}," +
            "thresUP1Word=#{thresUP1Word}," +
            "thresUP2Word=#{thresUP2Word}," +
            "thresLow1Word=#{thresLow1Word}," +
            "thresLow2Word=#{thresLow2Word} where sensorNum=#{sensorNum}")
    void updateSensorManagement(SensorManagement sensorManagement);
}
